<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="root">
    <p>姓：<input v-model="firstName" type="text"></p>
    <p>名：<input v-model="lastName" type="text"></p>
    <p>全名：{{fullName}}</p>
</div>
</body>
<script>
    new Vue({
        el: "#root",
        data:{
            firstName:"",
            lastName:"",
            fullName:""
        },
        watch:{
            firstName(v){
                this.fullName = v+this.lastName;
            },
            lastName(v){
                this.fullName = this.firstName+v;
            }
        }
    })
</script>
</html>